package demo2;

/**
 * Created with IntelliJ IDEA.
 * User: 12629
 * Date: 2021/10/29
 * Time: 9:46
 * Description:
 */
class Animal {
    protected String name;
    public Animal(String name) {
        this.name = name;
    }
    //游泳  跑步  飞
}
interface IFlying {
    void fly();
}
interface IRunning {
    void run();
}
interface ISwimming {
    void swim();
}
class Cat extends Animal implements IRunning{

    public Cat(String name) {
        super(name);
    }

    @Override
    public void run() {
        System.out.println("猫在跑步！");
    }
}

class Frog extends Animal implements IRunning,ISwimming {

    public Frog(String name) {
        super(name);
    }

    @Override
    public void run() {
        System.out.println("青蛙正在跑！");
    }

    @Override
    public void swim() {
        System.out.println("青蛙正在游泳！");
    }
}

class Roobot implements IRunning{

    @Override
    public void run() {
        System.out.println("机器人在拍跑");
    }
}

public class Test3 {

    public static void func(IRunning iRunning) {
        iRunning.run();
    }

    public static void main(String[] args) {
        func(new Cat("猫"));
        func(new Frog("青蛙"));
        func(new Roobot());
    }

    public static void main2(String[] args) {
        IRunning iRunning1 = new Cat("猫");
        IRunning iRunning2 = new Frog("青蛙");

        ISwimming iSwimming = new Frog("青蛙");

    }

    public static void main1(String[] args) {
        Animal animal = new Cat("猫");

    }
}
